﻿<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo $title; ?></title>
</head>
<body>
	<div class="c-wrap">
	<div class="head">			
			<span>BẢNG LƯƠNG <img class="ent" src="http://localhost/qlc/media/images/6.png" alt=""></span>						
								
		</div>
	</div>
	<div class="myedit">
	<table>
		<tbody>				
			<ul style=" border-bottom: 1px solid #333333;">
				<li style="color:#000000; width: 50px">STT</li>				
				<li class="divider1"></li>
				<li style="color:#000000; width: 150px">Họ tên</li>			
				<li class="divider1"></li>
				<li style="color:#000000; width: 100px">Mức lương</li>	
				<li class="divider1"></li>			
				<li style="color:#000000; width: 70px">Ngày công</li>	
				<li class="divider1"></li>				
				<li style="color:#000000; width: 100px">Phụ cấp xăng</li>		
				<li class="divider1"></li>				
				<li style="color:#000000; width: 100px">Phụ cấp ăn trưa</li>		
				<li class="divider1"></li>				
				<li style="color:#000000; width: 100px">Phí bảo hiểm</li>		
				<li class="divider1"></li>				
				<li style="color:#000000; width: 100px">Chuyên cần</li>		
				<li class="divider1"></li>				
				<li style="color:#000000; width: 100px">Tổng lương</li>								
			</ul>				
			</tbody>			
		</table>
		<table>
		<tbody>	
		<?php 
			ob_start();
			require_once('db.php');
			$c = 0;
			$stt = 0 ;			
			foreach($item as $row){
				$stt++;
				$i = $row['id'];
				$sql = mysql_query("select * from nghiphep where id = '$i'");
				$info = mysql_fetch_array($sql);
				if($info['cophep'] == 0 && $info['khongphep']==0)
				{
					$c = 500000;						
				}
				$sql1 = mysql_query("select * from bangluong where id = '$i'");
				$inf = mysql_fetch_array($sql1);
				if($inf['ngaycong']==0){
					$tong = 0;
				}else {			
					$tong = $inf['ngaycong'] * $inf['bacluong'];				
					$tong = $tong + $inf['phucapxang'];
					$tong = $tong + $inf['phucapantrua'];				
					$tong = $tong - $inf['phibaohiem'];
					$tong = $tong + $c;					
				}
				$a = mysql_query("update `bangluong` set `tongluong` = '{$tong}' where id = '$i'");
				echo "<ul style='background: #FFFFFF'>";
				echo "<li class='' style='width: 50px;'>$stt</td>";			
				
				echo "<li class='' style='width: 150px;'>$inf[name]</td>";
				
				echo "<li class='' style='width: 100px;'>$inf[bacluong].đ</td>";
				
				echo "<li class='' style='width: 70px;'>$inf[ngaycong]</td>";
				
				echo "<li class='' style='width: 100px;'>$inf[phucapxang].đ</td>";
				
				echo "<li class='' style='width: 100px;'>$inf[phucapantrua].đ</td>";
				
				echo "<li class='' style='width: 100px;'>$inf[phibaohiem].đ</td>";
				
				echo "<li class='' style='width: 100px;'>$c.đ</td>";
				
				echo "<li class='' style='width: 100px;'>$inf[tongluong].đ</td>";							
			
				echo "</ul>";			
			}
			ob_end_flush();
		?>
		</tbody>
		</table>
	</div>
</div>
</body>
</html>